<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
    <title>按医疗机构查看详情</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
                            
    <section class="content-header">
        <h1>分院采购情况查看</h1>
        <ol class="breadcrumb">
           <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购计划管理</a></li>
            <li class="active"><a href="#">分院采购情况查看</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">
                    <div class="form-group form-group-xs">
                        <label for="searchDrugCode">药品编码:</label>
                        <input class="form-control" type="text" id="searchDrugCode" placeholder="药品编码" maxlength="18" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="searchDrugName">通用名:</label>
                        <input class="form-control" type="text" id="searchDrugName" placeholder="通用名" maxlength="127" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="searchCompName">生产企业:</label>
                        <input class="form-control" type="text" id="searchCompName" placeholder="生产企业" maxlength="127" />
                    </div>
                    <button type="button" class="btn btn-success btn-sm" onclick="search();" id="selectc">查询</button>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
        <div class=" box box-warning bottongroup">
             <button onclick="history.go(-1)" class="btn btn-default btn-sm" >返&nbsp;回</button>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
	    //绑定回车
	    $('#searchDrugCode,#searchDrugName,#searchCompName').bind('keydown', function(event) {
	        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
	            $('#selectc').click();
	        }
	    }); 
			
	    $("#searchDrugCode").focus();//加载页面光标在第一个查询框内
	    
        function search(page) {
            var searchDrugCode = $("#searchDrugCode").val();
            var searchDrugName = $("#searchDrugName").val();
            var searchCompName = $("#searchCompName").val();
            
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"drugCode":searchDrugCode, "drugName":searchDrugName, "compName":searchCompName},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
    
        $(function () {
            
            $("#gridlist").jqGrid({
                url: "getBidCollectDetailsByHosp.html",
                mtype: "post",
                datatype: "json",
                postData: {"projId":"${projId}", "hospId":"${hospId}"},
                autowidth: true,
                height: 270,
                colNames: [
                    '药品编码', 
                    '通用名',
                    '剂型',
                    '规格', 
                    '转换系数',
                    '单位',
                    '材质',
                    '生产企业',
                    '去年采购数量',
                    '计划采购数量',
                    '采购方式',
                    '质量要求',
                    'projId'
                ],
                colModel: [
                    { name: 'drugCode', width: 10, align:"center", sortable: false,
                        formatter:function(cellvalue, options, row) {
                        	var str = "<a href=\"javascript:void(0)\" onclick=\"showDrugInfo('"+row.drugCode+"','"+row.drugName+"')\">"+cellvalue+"</a>";
                        	return str;
                        }
                    },
                    { name: 'drugName', width: 10, align:"center", sortable: false },
                    { name: 'formName', width: 10, align:"center", sortable: false},
                    { name: 'specName', width: 10, align:"center", sortable: false},
                    { name: 'factor', width: 10, align:"center", sortable: false},
                    { name: 'unit', width: 10, align:"center", sortable: false},
                    { name: 'materialName', width: 10, align:"center", sortable: false},
                    { name: 'compName', width: 20, align:"center", sortable: false,
                    	 formatter:function(cellvalue, options, row) {
                         	var str = "<a href=\"javascript:void(0)\" onclick=\"showCompInfo('"+row.compCode+"','"+row.compName+"')\">"+cellvalue+"</a>";
                         	return str;
                         }	
                    },
                    { name: 'lasyProAmt', width: 10, align:"center", sortable: false},
                    { name: 'planProAmt', width: 10, align:"center", sortable: false},
                    { name: 'proMethod', width: 10, align:"center", sortable: false},
                    { name: 'qualityRequires', width: 10, align:"center", sortable: false},
                    { name: 'projId',hidden:true, width: 10, align:"center", sortable: false}
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "${projName} - ${hospName} - 详情",
                jsonReader: {
                   
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            
        });    
    </script>
</body>
</html>